<?php
function curl_post($url,$data,$cookie=null,$cookie_file=null){
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($ch, CURLOPT_POST, 1);
    if($cookie){
        curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
    }

    if($cookie_file){
        curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
    }
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    $output = curl_exec($ch);
    curl_close($ch);
    return $output;
}

//模拟注册
//for ($i=0;$i<1;$i++){
//$url = 'http://seckill.phpdongyi.cn/register';
//$mobile = "1325341".mt_rand(1000,9999);
//$data = ['mobile'=>$mobile,'password'=>'123456'];
//$res = curl_post($url,$data,$mobile);
//echo $res;
//}

//模拟登陆
$url = 'http://seckill.phpdongyi.cn/login';
$mobile = "13253411920";
$data = ['mobile'=>$mobile,'password'=>'123456'];
$res = curl_post($url,$data,null,$mobile);
dump($res);